package patrol.mobile.com.mobilepatrol.activity;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.adapter.MyHomeAdapter;
import patrol.mobile.com.mobilepatrol.bean.HomeDataBean;
import patrol.mobile.com.mobilepatrol.utils.CommonUtil;

public abstract class CommonHomeActivity extends BaseActivity {

    @BindView(R.id.recyclerView)
    protected RecyclerView recyclerView;
    @BindView(R.id.recyclerViewYW)
    protected RecyclerView recyclerViewYW;


    protected MyHomeAdapter mAdapter;
    protected MyHomeAdapter mAdapterYW;

    @BindView(R.id.ll_ZH_YW)
    protected LinearLayout llZHYW;

    @BindView(R.id.tv_ZH)
    protected TextView tvZH;

    @BindView(R.id.tv_YW)
    protected TextView tvYW;

    @BindView(R.id.tv_HZ)
    protected TextView tvHZ;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_office_home;
    }

    @Override
    public void initTitle() {
        super.initTitle();
        iv_back.setImageResource(R.mipmap.up_white);
        iv_back.setVisibility(View.VISIBLE);
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                CommonUtil.exitActivityAndBackAnim(CommonHomeActivity.this, true);
            }
        });
        tv_center_title.setVisibility(View.VISIBLE);
        tv_center_title.setText(initTitleName());
    }

    @Override
    public void initData() {
        super.initData();
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new MyHomeAdapter(this);
        recyclerView.setAdapter(mAdapter);
        mAdapter.setData(initAdapterData());

        recyclerViewYW.setLayoutManager(new LinearLayoutManager(this));
        mAdapterYW = new MyHomeAdapter(this);
//        recyclerViewYW.setAdapter(mAdapterYW);
//        mAdapterYW.setData(initAdapterData());

    }

    @NonNull
    protected abstract String initTitleName();

    @NonNull
    protected abstract List<HomeDataBean> initAdapterData();

    @Override
    public void setListener() {

    }
}
